﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchemaMonitor.json
{
    public class COffset : CDict
    {
        //Data
        public string Id;
        public string Name;
        public int Offset;
        public string Type;
        public int Length;

        //Constructors
        public COffset(object dict) : this((Dictionary<string, object>)dict) { }
        public COffset(Dictionary<string, object> dict) : base(dict)
        {
            Id  = AsStr("id");
            Name = AsStr("name");
            Type = AsStr("type");
            Offset = AsInt("offset");
            Length = AsInt("length");
        }

        public void Clean()
        {
            try
            {
                this.Remove("type");
                this.Remove("offset");
                this.Remove("length");
            }
            catch { }
        }
    }
}
